perm filename USEM11.LCS[UP,DOC] blob
sn#412158 filedate 1979-01-19 generic text, type T, neo UTF8
00100 ********** Using the MUS11 (MUSIC5) Program **********
00200
00300 ******* WORK IN PROGRESS -- Jan 79 -- LELAND SMITH *********
00400
00500 This manual is designed for use with the PDP10 at the Stanford AI
00600 lab. In most cases this text will also apply to the program when
00700 used on a large PDP11 system.
00800
00900 MUS11 is a complete sound generating package which exists on the
01000 disk. For first attempts type:
01200
01300 R MUS11
01400 (All lines must be terminated with the 'RETURN' key.)
01500
01600 At this point the program will type the message:
01700
01800 INPUT?
01900
02000 Basically there are two responses possible. If the program is to
02100 receive further instructions from another file which has been
02200 prepared with an editing program, type:
02300
02400 NAME -- where NAME is the name of the file to be read.
02500 (If NAME has an extension, it must be used!)
02600
02700 If instructions are to be entered by means of the teletype keyboard
02800 (TTY mode), type carriage return (<CR>).
02900
03000 At this point the sign (>) will appear which means the program is
03100 awaiting input.
03200
03300 (It is possible that an error message such as "Ill mem. rel" or
03400 "Halt" will sometimes appear. If this happens first type 'S' -- to
03500 restart the program -- and then type in exactly whatever you had
03600 typed before. If the error message recurs, find an "expert.")
03700
03800
03900 Most complete statements to be read by MUS11 must end with a
04000 semicolon. Several complete statements may be entered on a single
04100 line but it is best not to have the lines too long. More than one
04200 line may be used for a single statement. If the less-than sign (<)
04300 appears everything following on that line will be ignored. Use this
04400 for entering comments.
04500
04600 ***** Note that the above rules DO NOT apply to the syntax
04700 of the SCORE program.
04800
04900 Already present in MUS11 is an "instrument" known as SIMP which has
05000 been set to play a test tone of 'A' (440 hz) for 1/2 second.
05100
05200 In order to play this tone, first get into TTY mode as described
05300 above, then type:
05400
05500 PLAY;SIMP;FINISH;
05600
05700 When the computation ends "TEST.SND" will be typed out. This means
05800 that sound data has been written on the disk under the name
05900 "TEST.SND." You will also be given other information such as the
06000 maximum amplitude encountered, the number of bits per sample, etc.
06100
06200 Immediately after this the following message will appear:
06300 SPEED NUM, <CR>, OR "X". This means you have three options. <CR>
06400 means to hit the "RETURN" key. At this point hitting <CR> will cause
06500 computed sound to play (unless someone else's program has momentary
06600 control over the devices you need.) Each time you hit the "RETURN"
06700 key the process will be repeated.
06800
06900 The sound will be playing at SPEED 1. The SPEEDs available are 0
07000 through 5. 0 plays 1/2 as fast as 1, hence an octave lower; 2 plays
07100 twice as fast; 3 plays four times as fast; 4 plays eight times as
07200 fast; 5 plays sixteen times as fast. If you type "X" the program
07300 will exit from the "play" mode and return the symbol ">", which means
07400 it is waiting for some new command. When "X" is typed, you will get
07500 the message "PLEASE DELETE SOUND FILE". This means that when you have
07600 finished your work you should type <CALL>, then "DEL TEST.SND <CR> so
07700 the space on the disk taken up by your sound tests may be reclaimed.
07800
07900 The speed at which the sound will play is determined by the sampling
08000 rate which was used during the computation. The default sampling
08100 rate in 'MUS11' is 12800. (See later on how to change this.)
08200
08300 If you have typed an "X" but wish to return to "play" mode, type $P;
08400 where '$' indicates the 'ALT' key.
08500
08600
08700 ******************************************************
08800
08900 The instrument SIMP has five parameters.
09000
09100 P1 = begin time of note (in seconds)
09200 P2 = duration of note " "
09300 P3 = pitch
09400 P4 = amplitude
09500 P5 = wave form (or timbre)
09600
09700 P1 and P2 will have the same significance in all instruments but all
09800 higher numbered parameters are assigned roles according to
09900 convenience. (However it will prove useful to apply P3 and P4
10000 consistently as above.)
10100
10200 Internally all pitch entries become numerical, however the twelve
10300 frequencies of the tempered chromatic scale, from middle C (261.62
10400 hz) up to B may be used in MUS11 by typing the letter names of the
10500 notes. The letters S = # and F = flat.
10600
10700 Since these letters merely represent the frequencies of each note,
10800 the octave range may be changed by multiplying or dividing by
10900 multiples of two. Thus C or A in the octave below middle C would be
11000 entered as C/2 or A/2. In the octave above the basic middle octave
11100 these notes would be C*2 or A*2.
11200
11300 C -- 2 octaves down would be C/4
11400 C -- 3 octaves down would be C/8
11500 C -- 2 octaves up would be C*4
11600 C -- 3 octaves up would be C*8 etc.
11700
11800 To test the use of these letters try:
11900
12000 P3←C;PLAY;SIMP;FINISH;
12100
12200 Now instrument SIMP will compute middle C instead of A. The left
12300 arrow (←) indicates that the value of C has been placed in P3,
12400 replacing any value that was previously there. (The left arrow and
12500 the equals sign[=] are interchangeable in this program. In some
12600 printings the left arrow will appear as an "underline"[_]. Try not
12700 to be confused by this.)
12800
12900 PLAY;SIMP;FINISH; must be typed so the new note will be computed.
13000 After it is first heard it may be repeated as indicated above.
13100
13200 If frequencies other than those of the tempered scale are to be
13300 played, a number may be used instead of a letter.
13400
13500 P3←1000;PLAY;SIMP;FINISH; will play a tone at 1000 hz.
13600
13700
13800 The amplitude scale available is the range of numbers from 0 to 2047.
13900 (This upper limit is set by the number of bits [12] used for the
14000 sound samples. See appendix.) P4 has been set at 1000 for the test
14100 tone. This may be reset using the same method as described before.
14200
14300 P4←100;P3←GS*2;PLAY;SIMP;FINISH;
14400
14500 This will play a G# above the middle octave at amplitude 100.
14600
14700 The duration of the tone may be changed be resetting P2.
14800
14900 P2←.1; will play a note of 1/10 sec. duration.
15000
15100 In general, test tones should rarely exceed 1" duration.
15200
15300 When several parameters are to be changed at once the following
15400 type-in format should be used:
15500
15600 PLAY;SIMP 0 .2 FS/2 850;FINISH;
15700
15800 This will play F# below middle C for 2/10" at an amplitude of 850.
15900 (Please note that P5, the wave form for SIMP, will be dealt with
16000 later.)
16100
16200 ********** COMMAS **********
16300
16400 Commas may be used to separate the parameters and if nothing precedes
16500 a comma the contents of that parameter remains unchanged. Also any
16600 parameter numbers higher than the length of the list will not be
16700 affected.
16800
16900 PLAY;SIMP , .3, , 1200;FINISH; changes only P2 and P4.
17000
17100 ******************************************************
17200
17300 A string of notes may be played with the following input:
17400
17500 PLAY;SIMP 0 .2 C 1500;SIMP .2, , D;SIMP .4, , E;
17600 SIMP .6, , C;FINISH;
17700
17800 In this case P1 must be updated for each note. (Never overlap an
17900 instrument with itself. Distortion will occur.) P2, the note
18000 duration remains unchanged, so the commas suffice for the last three
18100 notes. P4, coming at the end of the list for the first note need
18200 only be stated once if it is not to change.
18300
18400 Rests are created by simply leaving some time between the end of one
18500 note (P1+P2) and the beginning of the next (the new P1).
18600
18700 PLAY;SIMP 0 .2 C;SIMP .5;FINISH; will play C for 2/10",
18800 rest for 3/10" and then play another C for 2/10".
18900
19000
19100 ********** FUNCTIONS **********
19200
19300 The wave form in P5 is entered by means of a name which is used by
19400 the program to locate a list, or array, of numbers (512) which
19500 describe the wave. The names used for this purpose will always be F
19600 followed directly by a number. These arrays will be called
19700 "functions."
19800
19900 There are 6 functions in MUS11 when you first run it. More can be
20000 added at any time. The functions present are F1, F2, F3, F4, F5 and
20100 F6. F2 and F3 are used for envelopes, F1 describes a sine wave and
20200 F4, F5 and F6 are more complicated timbres.
20300
20400 Functions may be created with an external program called FUNC or
20500 within MUS11 itself by means of two routines called SYNTH and SEG.
20600 SYNTH is used to create composites made by adding various harmonics
20700 together. The form of F1 could be changed in the following manner:
20800
20900 SYNTH(F1); 1,1 2,1 3,.5 999;
21000
21100 In the three pairs of numbers, the first of each pair represents the
21200 harmonic number and the second the relative amplitude of that
21300 harmonic. Thus the ratios of harmonics 1, 2 and 3 will be 1:1:.5 .
21400
21500 The size of the second number of each pair is important only in its
21600 relation to the other amplitude numbers. The last number, 999, is
21700 used to signal the termination of a string of entries.
21800
21900 Several pairs may entered and harmonic numbers up to 256 may be used
22000 but in practice great care must be taken to avoid the "foldover"
22100 effect which occurs when frequencies higher than one half the
22200 sampling rate are present. (See appendix.)
22300
22400 It should be pointed out that the fundamental (harmonic #1) need not
22500 be present in a wave.
22600
22700 SYNTH(F1); 10,1 12,1 15,1 999; will give the three notes
22800 of a minor chord. After this has been entered the following will
22900 cause a C minor chord to play:
23000
23100 PLAY;SIMP 0 .5 GS/8;FINISH;
23200
23300 While the lowest Ab (or G#) on the piano keyboard has been indicated,
23400 since the wave form includes only the 10th, 12th and 16th harmonics,
23500 the notes middle C, Eb and G will be heard.
23600
23700 Several experiments with different wave forms should be made.
23800
23900 A function may be changed in the middle of a PLAY routine but it must
24000 be noted that the new wave definition must follow! the note which it
24100 is to affect.
24200
24300 In PLAY;SIMP 0 .3 D 1000; SIMP .3;
24400 SYNTH(F1); 1,.7 3,.2 5,.1 999;
24500 SIMP .6,,E; FINISH;
24600 the newly defined wave will be heard in the second and third notes.
24700
24800
24900 If you wish to have several functions with different names available
25000 and you do not create them with the FUNC program, their names must be
25100 "declared" to MUS11. Suppose you wish to have F11, F12 and F14. You
25200 must type directly to MUS11 (or into an EDIT file which will be read
25300 by MUS11) the following:
25400
25500 ARRAY F11,F12,F14(512);
25600
25700 The "(512)" indicates that each function array will require 512 words
25800 of storage.
25900
26000 The following example will play a sequence of notes wherein are heard
26100 the 10th, 14th and 18th harmonics of a low C, then the 10th, 13th and
26200 16th, and finally the 10th, 12th and 14th harmonics.
26300
26400 ARRAY F11,F12(512);
26500 SYNTH(F11);10,1 14,1 18,1 999;
26600 SYNTH(F12);10,1 13,1 16,1 999;
26700 SYNTH(F1);10,1 12,1 14,1 999;
26800 PLAY;SIMP 0 .3 C/4 2000 F11;
26900 SIMP .3,,,,F12;SIMP .6,,,,F1;FINISH;
27000
27100
27200
27300 From this point on it would probably be better to prepare any
27400 input for MUS11 which requires more than a couple of lines of typing
27500 with the SOS or ET editors. Typographical errors are inevitable and
27600 when an error is made near the beginning of a string of input typed
27700 directly to MUS11 you most likely will have to retype everything.
00100 A type of flow-chart diagram for SIMP would appear as follows:
00200
00300 P4 MAG*P3
00400 | |
00500 ↓ ↓
00600 ***************
00700 * * OSCIL
00800 * * U1 (UNIT GENERATOR ONE)
00900 * P5 *
01000 * *
01100 * *
01200 *********
01300 |
01400 ↓
01500 *****
01600 * OUT *
01700 * A *
01800 *****
01900
02000 The top left input, P4, serves simply as a multiplier for the numbers
02100 found in the wave form array, P5. The particular number from the
02200 array to be multiplied is determined by the number in the upper right
02300 input. The upper right input, in this case P3, when processed by
02400 "MAG" (the "magic" number) becomes the increment, the rate at which
02500 the wave form array is stepped through. The "magic" number is found
02600 by dividing the array length, 512, by the sampling rate, 12800.
02700
02800 512/SRATE=.04 (Higher sampling rates will be discussed later.)
02900
03000 The maximum size of the numbers in the wave array is + or -1. Thus
03100 if P4 is set to 1000 the output of the OSCIL will be numbers in the
03200 range +1000 to -1000 which will describe the wave form put into P5
03300 cycling at the rate given in P3.
03400
03500
03600 The code for entering this instrument follows:
03700
03800 INSTRUMENT SIMP;
03900 OSCIL(P4,MAG*P3,P5);
04000 OUTA←OUTA+U1;
04100 END;
04200
04300 This instrument has only one unit generator (the OSCIL) hence the
04400 output of U1 is added to the contents of OUTA. If there are several
04500 instruments the outputs of all the instruments will be combined in
04600 OUTA for each sample.
04700
04800 It will be noticed when playing instrument SIMP that the sound begins
04900 and ends quite abruptly. This is because no attack-decay envelope
05000 has been applied to the tone. The sound begins at the full amplitude
05100 of P4 and remains at that level for its total duration.
05200
00100 To apply an envelope, another unit generator must be added.
00200
00300
00400 P4 MAG/P2
00500 | |
00600 ↓ ↓
00700 ***************
00800 * * OSCIL
00900 * * U1 (UNIT GENERATOR ONE)
01000 * P5 *
01100 * *
01200 * *
01300 *********
01400 |
01500 | MAG*P3
01600 | |
01700 ↓ ↓
01800 ***************
01900 * * OSCIL
02000 * * U2 (UNIT GENERATOR TWO)
02100 * P6 *
02200 * *
02300 * *
02400 ********* INSTRUMENT TOOT;
02500 | OSCIL(P4,MAG/P2,P5);
02600 ↓ OSCIL(U1,MAG*P3,P6);
02700 ***** OUTA←OUTA+U2;
02800 * OUT * END;
02900 * A *
03000 *****
03100
03200 To create this instrument the definition listed above must be typed
03300 in. Now that the instrument has been expanded you will note that it
03400 is the output of unit generator two (U2) which goes to OUTA.
03500
03600 P5 will now contain the envelope array. This array is best defined
03700 by the SEG routine. SEG defines the positions of line segments used
03800 to approximate a curve. With SEG several pairs of numbers may be
03900 entered. The first number of each pair is an amplitude, normally in
04000 the range of 0 to 1, and the second is the step number in the array.
04100 The step numbers 1 through 100 are used in SEG. (However the step
04200 numbers are converted internally to 512 array locations.) Straight
04300 line segments are drawn between each of the points defined. The
04400 following would put a triangular envelope shape into F11.
04500
04600 ARRAY F11(512);
04700 SEG(F11); 0,1 1,50 0,100;
04800
04900 Note that the routine is terminated when step 100 is reached.
05000 DO NOT USE 999 with SEG.
05100
05200 After having typed in the code for instrument TOOT and the definition
05300 for an envelope in F11, the following will produce a note using that
05400 envelope:
05500
05600 SYNTH(F1);1,1 2,.4 3,.1 999;< Sets the tone color.
05700 PLAY;TOOT 0 .5 A 2000 F11 F1;FINISH;
05800
05900 If two envelopes are to be contrasted add another function and define
06000 it.
06100
06200 ARRAY F12(512);
06300 SEG(F12); 0,1 1,7 .2,25 .1,60 0,100;< Staccato
06400
06500 PLAY;
06600 TOOT 0 .2 1000 2000 F12 F1; < P5 has envelope
06700 TOOT .2 .5,,,F2;
06800 FINISH;<Plays stac. then sust.(F12 then F2)
06900
00100 In the next example a unit generator will be added above the right
00200 side of the bottom, tone producing unit generator. In this way a
00300 function may be used to describe fluctuations of pitch within the
00400 duration of a note -- much as the previous example gave the
00500 possibility for changing the amplitude during a single note.
00600
00700
00800 MAG*P7-MAG*P3 MAG/P8
00900 P4 MAG/P2 | |
01000 | | ↓ ↓
01100 ↓ ↓ ***************
01200 *************** * * OSCIL
01300 * * OSCIL * * U2
01400 * * U1 * P9 *
01500 * P5 * * *
01600 * * * *
01700 * * *********
01800 ********* MAG*P3 |
01900 | | _____________|
02000 |________ _↓___↓_
02100 | \ /
02200 | \ + /
02300 | \_/
02400 | |
02500 ↓ ↓
02600 ***************
02700 * *
02800 OSCIL * *
02900 U3 * P6 *
03000 * *
03100 * *
03200 ********* INSTRUMENT GLISS;
03300 | OSCIL(P4,MAG/P2,P5);
03400 ↓ OSCIL(MAG*P7-MAG*P3,MAG/P8,P9);
03500 ***** OSCIL(U1,MAG*P3+U2,P6);
03600 * OUT * OUTA←OUTA+U3;
03700 * A * END;
03800 *****
03900
04000
04100 In order for this instrument to perform glissandos, a third function
04200 must be defined for P9 (the "shape" of the glissando). A straight
04300 line slope will suffice for a simple glissando. After typing in the
04400 instrument definition set up the three functions.
04500
04600 ARRAY F5,F6(512); <all these are already present.
04700 SEG(F5);0,1 .8,7 1,12 1,90 0,100;<Envelope
04800 SEG(F6);0,1 1,100; <Slope
04900
05000 In the preceding, the ARRAY declaration is needed only when some new
05100 function names are to be used.
05200
05300 The following will play a glissando up two octaves, from C to C*4.
05400
05500 PLAY; GLISS 0 1 C 2000 F5 F1 C*4 1 F6; FINISH;
05600
05700 If P8←.5; (while P2 remains at 1) two glissandos will be heard.
05800
05900
06000
06100 This instrument may be used for a dramatic demonstration of
06200 "foldover", the phenomenon which occurs when a frequency exceeds the
06300 upper limit of one half the sampling rate. (See Mathews' book for a
06400 technical explanation.)
06500
06600 For this purpose it is best to use a Sine wave in P6.
06700
06800 SYNTH(F1); 1 1 999; <note that this original form of F1
06900
07000 PLAY; GLISS 0 1 1000 2000 F5 F1 4000 1 F6;FINISH;
07100
07200 This first note will slide up from 1000 hz to 4000 hz.
07300
07400
07500 PLAY; GLISS 0 1 1000 2000 F5 F1 11800 1 F6;FINISH;
07600
07700 Due to "foldover" (at 12800/2 hz.) this note will slide up to 6400 hz
07800 and return to the 1000 hz level even though 11800 hz was given in P7.
07900 The general rule for "foldover" is that any frequencies which exceed
08000 one half the sampling rate will be heard at (SRATE-F) hz.
08100
08200
08300 Try this one!
08400
08500 PLAY; GLISS 0 1 0 2000 F5 F1 30000 1 F6; FINISH;
08600
08700
08800 This same instrument may be used to produce a vibrato by putting a
08900 sine wave into P9, setting P8←1/7; (the vibrato rate will be 7 times
09000 per second) and making P7 some very small amount different from P3.
09100
09200 PLAY; GLISS 0 1 C 2000 F5 F1 C+2 1/7 F1; FINISH;
09300
09400 (It is assumed that F1 is a sine wave.)
00100 Various types of noise and other random fluctuations are
00200 produced by the two random number unit generators. These are called
00300 RANDH and RANDI. RANDH (H=hold) produces in effect a function made
00400 up of horizantal lines at various levels with a perpendicular jump
00500 from one level to the next. There are two inputs to RANDH. The
00600 first (left hand) gives the range, plus or minus, of random
00700 selection and the second (right hand) gives the rate (per second) at
00800 which the selections are to be made.
00900
01000 Care must be taken with the number in the first input. If
01100 the number 100 is given, the output of RANDH will fluctuate between
01200 +100 and -100. Thus if a range of 100 to 200 is desired, the input
01300 number should be 50 and the number 150 must be added to the output.
01400
01500
01600 MAG*P7 MAG*P8
01700 P4 MAG/P2 | |
01800 | | ↓ ↓
01900 ↓ ↓ ***************
02000 *************** * *
02100 * * OSCIL * RANDH * U2
02200 * * U1 ***************
02300 * P5 * |
02400 * * |
02500 * * |
02600 ********* MAG*P3 |
02700 | | _____________|
02800 |________ _↓___↓_
02900 | \ /
03000 | \ + /
03100 | \_/
03200 | |
03300 ↓ ↓
03400 ***************
03500 * *
03600 OSCIL * *
03700 U3 * P6 *
03800 * *
03900 * *
04000 ********* INSTRUMENT NOISE;
04100 | OSCIL(P4,MAG/P2,P5);
04200 ↓ RANDH(MAG*P7,MAG*P8);
04300 ***** OSCIL(U1,MAG*P3+U2,P6);
04400 * OUT * OUTA←OUTA+U3;
04500 * A * END;
04600 *****
04700
04800 ARRAY F2(512); <F2 actually is already present.
04900 SEG(F2);0,1 .8,7 1,12 1,90 0,100;<Env.
05000
05100
05200
05300
05400 The following will produce white noise.
05500
05600 SRATE←25600;MAG←512/SRATE;
05700 PLAY;NOISE 0 .5 C*8 1000 F2 F1 P3 P3*4;FINISH;
05800
05900 Actually P8 (given as P3*4) can probably be left at a number
06000 like 4000 for noise purposes. As P7 is changed the apparent
06100 band-width of the noise will be changed. As the band-width gets
06200 narrower the center frequency becomes more apparent. Thus if P7←P3/16
06300 and P3 is up in the range of C*8, something of the effect of blowing
06400 across an open tube will be produced. The pitch is clear -- but
06500 quite windy.
06600
06700 The SRATE (sampling rate) must be increased for noise
06800 production since very high frequencies are essential. At SRATE←25600
06900 the high frequency cut-off will be at 12800 hz.
07000
07100 **** For a simple way to reset the SRATE type the following:
07200
07300 SETMAG; 1 25600
07400
07500 The first number, 1, refers to the number of channels and
07600 the second is the sampling rate. MAG, the magic number, will
07700 be reset automatically.
07800
07900 If P8 is set to a low number (e.g. 8) individual random
08000 pitches, instead of noise, will be produced at that rate.
08100
08200
08300 If the random unit generator is replaced by a RANDI the
08400 random function produced will be made up of a series of slopes
08500 (I=interpolating) up and down from one random point to another. In
08600 the case of noise production there is little difference between RANDI
08700 and RANDH. However RANDI is necessary for getting such things as
08800 random vibrato. The following will produce an acceptable, "human"
08900 sounding vibrato.
09000
09100 PLAY; NOISE 0 1 C*2 1000 F2 F1 P3*.01 16; FINISH;
09200
09300 The random rate of 16 per second (in P8) is considerably
09400 faster than the human vibrato rate of 5 to 8 per second. In this
09500 case however since the full band-width (in P7) is only seldom
09600 attained and the heard effect is that of a rate much slower than 16.
09700
00100 With an ordinary OSCIL there is no simple way to have a long note
00200 keep the same characteristics of attack and decay as a short note.
00300 The LINEN unit generator is used to create envelopes with separate
00400 controls over attack time, decay time and steady state.
00500
00600
00700 P7 P8 P9
00800 | | |
00900 P4 ↓ ↓ ↓ VAR
01000 | *************** |
01100 | * * | LINEN
01200 | * * | U1 (UNIT GENERATOR ONE)
01300 |___ * P5 * ___|
01400 * *
01500 * *
01600 ***************************
01700 |
01800 | MAG*P3
01900 | |
02000 ↓ ↓
02100 ***************
02200 * * COSCIL
02300 * * U2 (UNIT GENERATOR TWO)
02400 * P6 *
02500 * * VARIABLE VAR;
02600 * *
02700 ********* INSTRUMENT LIN;
02800 | LINEN(P4,P7,P8,P9,P5,VAR);
02900 ↓ COSCIL(U1,MAG*P3,P6);
03000 ***** OUTA←OUTA+U2;
03100 * OUT * END;
03200 * A *
03300 *****
03400
03500
03600
03700 The parameter arrangement for LINEN is rather different from that for
03800 OSCIL. The far left parameter (P4) is, as usual, an amplitude input.
03900 The next three (P7, P8 and P9 in this particular example) will
04000 receive the attack duration, the decay duration and the total
04100 duration of the envelope, in that order. The next item in the
04200 parameter list (P5 here) will contain the envelope array name. The
04300 last item is an "I-time" variable which is needed to ensure that
04400 each note uses the correct portion of the overall envelope. (I-time
04500 refers to the fact that it is referenced only at the beginning, or
04600 input time, of each note.)
04700
04800 The internal workings of LINEN make it unnecessary to use "MAG" with
04900 the 3 time domain parameters. The proper conversion of time to
05000 increments is automatic. The 3rd parameter (P9) of this group could
05100 have been P2. However since P2 is always a special parameter which
05200 tells how long the instrument is to be turned, its use to indicate
05300 the total duration of the envelope would make it impossible to play
05400 several notes within one envelope cycle (a phrase.)
05500
05600 The array used for LINEN must be defined in a special way. Only the
05700 first 3/4 of the available locations are to be used. When using SEG,
05800 steps 1-25 are reserved for the attack portion, steps 26-50 for the
05900 "steady state" and steps 51-75 for the decay portion. Steps 76-100
06000 are ignored by LINEN but must be included in the SEG input in order
06100 for the SEG routine to conclude properly. To test the properties of
06200 LINEN it is best to construct an envelope with dramatic changes.
06300
06400 ARRAY F2(512);
06500 SEG(F2); 0,1 1,2 .3,25 1,50 0,75 0,100;
06600
06700 If parameters 7, 8 and 9 are set properly, this array will give a
06800 sharp attack followed by a return to a low amplitude (.3) at the
06900 start of the "steady state" section. Following there will be a
07000 relatively slow crescendo to full amplitude and then a rapid decay.
07100 It must be emphasized that the sum of the values given for P7 and P8
07200 (attack and decay) must never exceed the value of P9 (total
07300 duration.) Likewise, P9 should never be less than P2, (the total time
07400 the instrument is turned on for a single note.) To visualize the true
07500 shape of the envelope for any particular note duration (ND) consider
07600 that the time spent in the middle section of the array (SS="steady
07700 state" area) will be what is left when the attack (AT) and decay (DK)
07800 are subtracted from the total duration (TD.)
07900
08000 SS = TD - AT - DK
08100
08200 PLAY; LIN 0 1 A 2000 F2 F1 .08 .08 1; VAR=0; FINISH;
08300
08400
08500 The special variable VAR is used to reset a pointer for the
08600 initialization of the envelope. A unique variable must be used for
08700 each LINEN unit generator. The variable must be set to 0 immediately
08800 after! each detached note or after the first note of a phrase.
08900
09000 In the following, the 2 notes D, F will be connected (phrased) and
09100 the 3rd note, C#, will be detached. Notice that the first value
09200 given in P9 (total duration of envelope) represents the total
09300 duration of the first 2 notes. P9 is changed to equal P2 for the
09400 separate note.
09500
09600 PLAY; LIN 0 .5 D 2000 F2 F1 .08 .08 1; VAR=0;
09700 LIN .5 .5 F; < P4 to P9 remain the same.
09800 LIN 1 .5 CS 2000 F2 F1 .08 .08 .5; VAR=0;
09900 FINISH;
10000
10100
10200 You will have noticed that the last unit generator in this instrument
10300 is called a COSCIL. This is exactly like an OSCIL except that the
10400 pointer to the array is never re-initialized. This allows the wave
10500 form produced to be continuous from one note to the next. (The "C"
10600 indicates it is a "continuing" OSCIL). If an OSCIL were used in this
10700 situation clicks would often be heard between phrased notes.
10800
00100 Frequency modulation allows for the production of a wide
00200 variety of tone colors using relatively little compute time. The
00300 INTRP unit generator is really just a combination of an OSCIL and an
00400 ADD box. The left input represents the output when the function (P10
00500 below) is at zero and the right input represents the output when the
00600 function is at 1 (peak amplitude). No time input is given with
00700 INTRP. The speed of stepping through the function array is always
00800 taken as being P2, i.e. the note duration. In this case P10 will
00900 contain an envelope which will control the changes in frequency
01000 modulation. For a full explanation of FM see John Chowning's AES
01100 Journal article on this subject.
01200
01300
01400 P9*P7*MAG P8*P9*MAG
01500 | |
01600 ↓ ↓
01700 ***************
01800 * *
01900 * P10 * INTRP
02000 * * U2
02100 * *
02200 * *
02300 * *
02400 * P9*MAG
02500 P4 MAG/P2 | |
02600 | | ↓ ↓
02700 ↓ ↓ ***************
02800 *************** * * OSCIL
02900 * * OSCIL * * U3
03000 * * U1 * P11 *
03100 * P5 * * *
03200 * * * *
03300 * * *********
03400 ********* MAG*P3 |
03500 | | _____________|
03600 |________ _↓___↓_
03700 | \ /
03800 | \ + /
03900 | \_/
04000 | |
04100 ↓ ↓
04200 ***************
04300 * *
04400 NOSCIL * *
04500 U4 * P6 *
04600 * *
04700 * *
04800 ********* INSTRUMENT FM;
04900 | OSCIL(P4,MAG/P2,P5);
05000 ↓ INTRP(P7*P9*MAG,P8*P9*MAG,P10);
05100 ***** OSCIL(U2,P9*MAG,P11);
05200 * OUT * NOSCIL(U1,U3+P3*MAG,P6);
05300 * A * OUTA←OUTA+U4;
05400 ***** END;
05500
05600
05700
05800 You will notice that the last OSCIL is here changed to a NOSCIL.
05900 This is necessary because FM often requires that the frequency
06000 given the last unit generator is negative. If an OSCIL were
06100 used here an error message would result.
06200
06300 The following functions should be set up to test the FM instrument.
06400
06500 ARRAY F1,F2,F3(512); < all these are already declared in MUS11
06600 SYNTH(F1); 1 1 999; < A sine wave.
06700 SEG(F2);0,1 .9,4 1,8 1,72 .8,88 .5,95 0,100; < Envelope
06800 SEG(F3); 0,1 1,100; < An upward slope or ramp.
06900
07000 The following will produce a shift from a pure sine tone to a
07100 highly modulated tone over a period of 2 seconds.
07200
07300 PLAY; FM 0 2 100 1000 F2 F1 0 10 100 F3 F1; FINISH;
07400
07500
07600 To reverse the procedure, i.e. change from the modulated tone
07700 to the pure tone, reverse the values of P7 and P8.
07800
07900 P7←10; P8←0; PLAY;FM;FINISH;
08000
08100
08200 Change F2 (the ramp) to make the modulation emerge only in
08300 the mid-part of the note.
08400
08500 SEG(F2); 0,1 1,50 0,100; < Makes a triangle.
08600
08700 PLAY;FM;FINISH;
08800
08900 Try several of the variations suggested in Chowning's article.
09000
00100 ********* STEREO SOUND ***************
00200
00300 P4 MAG/P2
00400 | |
00500 ↓ ↓
00600 ***************
00700 * * OSCIL
00800 * * U1 (UNIT GENERATOR ONE)
00900 * P5 *
01000 * *
01100 * *
01200 *********
01300 |
01400 | MAG*P3
01500 | |
01600 ↓ ↓
01700 ***************
01800 * * OSCIL
01900 * * U2 (UNIT GENERATOR TWO)
02000 * P6 *
02100 * *
02200 * *
02300 *********
02400 | INSTRUMENT STER;
02500 P7__ | __(1-P7) OSCIL(P4,MAG/P2,P5);
02600 \ / \ / OSCIL(U1,MAG*P3,P6);
02700 *___/ \___* OUTA←OUTA+U2*P7;
02800 ↓ ↓ OUTB←OUTB+U2*(1-P7);
02900 ***** ***** END;
03000 * OUT * * OUT * NCHNS←2;
03100 * A * * B *
03200 ***** *****
03300
03400
03500
03600 Any instrument may have stereo capability by simply adding an
03700 OUTB. NCHNS is normally set to 1 in MUS11. For stereo NCHNS must be
03800 set to 2. This causes the sound samples to be multiplexed. That is,
03900 the odd numbered samples will be for channel A and the even numbered
04000 samples will be for channel B. (Thus twice as many samples are
04100 computed for the same duration of sound.)
04200
04300 In the above example the use of a number between zero and 1 in
04400 P7 will control the stereo position. If P7←1 all the sound will be
04500 be directed to OUTA. If P7←0 all the sound will be directed to OUTB.
04600 When P7←.5 then 50% of the sound will go to each channel.
04700 Try the following:
04800
04900 PLAY; STER 0 .3 A 1000 F2 F1 1; P7←0; STER .4; FINISH;
05000
05100 Note that a unit generator may replace P7. Thus, depending upon
05200 the shape of the function used, a single, continuous sound may be
05300 caused to move from channel to channel.
00100 ***************** CONDITIONALS WITHIN AN INSTRUMENT *****************
00200
00300 Any instrument definition may include ALGOL-like conditional
00400 statements. ALGOL statements may include IF, WHILE, FOR, UNTIL,
00500 THEN, DO, DONE, EXIT, END, ELSE, BEGIN and STEP and the special
00600 symbols for equals(=), not equal (≠), less than (<), greater than
00700 (>), less than or equal (≤) and greater than or equal (≤). Also,
00800 special functions using these terms may be written independent of
00900 instrument definitions. Examples may be seen in
01000 INIT.MUS[MUS,LCS]. See MUS11.DOC[MUS,LCS] for details. See
01100 SCORE.LCS[UP,DOC] concerning the use of these functions within
01200 play lists.
01300
01400 In the following stereo instrument (the design as given on the
01500 previous page) the stereo position of the sound is determined by
01600 the pitch range of the note. Notes at 100 hz or lower will be
01700 heard in channel A. Notes at 1100 hz or higher will be in channel
01800 B. A note at 600 hz will appear half way between A and B, etc.
01900
02000 In the second set of conditionals the particular function for tone
02100 color is also determined by pitch. The lowest notes will use F6,
02200 the medium low range will use F5, the medium high range will use
02300 F4 and the highest range will use F1.
02400
02500 These conditionals may be used for a wide variety of purposes.
02600
02700
02800 INSTRUMENT STERX;
02900 P7 ← (P3-100)/1000;
03000 IF P7 > 1 THEN P7 ←1;
03100 IF P7 < 0 THEN P7 ←0;< stereo position determined by pitch.
03200
03300 P6←F6; IF P3 > D/2 THEN P6←F5; <tone choice also set by pitch.
03400 IF P3 > C*2 THEN P6←F4; IF P3 > F*4 THEN P6←F1;
03500
03600 OSCIL(P4,MAG/P2,P5);
03700 OSCIL(U1,MAG*P3,P6);
03800 OUTA←OUTA+U2*P7;
03900 OUTB←OUTB+U2*(1-P7);
04000 END;
04100 NCHNS←2;
04200
04300 Try the following play list. It is assumed that 4 different tone
04400 functions have been set up in F1, F4, F5 and F6.
04500
04600 PLAY; STERX 0 .5 A/4 1000 F2;
04700 STERX .5 .5 A/2;
04800 STERX 1 .5 A*2;
04900 STERX 1.5 .5 A*4; FINISH;
05000
05100 It will be noted that no mention is made of P6 or P7. This is
05200 because these two parameters will be determined for each note by
05300 the ALGOL code within the instrument.
05400
00100 ************* INSTRUMENTS CONTROLLING OTHER INSTRUMENTS ***********
00200
00300 P4 MAG/P2
00400 ↓ ↓
00500 ***************
00600 * * OSCIL
00700 * *
00800 * P5 * VARIABLE /PX4;
00900 * * INSTRUMENT AMPL;
01000 * * PX4 ← OSCIL(P4,MAG/P2,P5);
01100 ********* END;
01200 |
01300 ↓
01400 PX4 PX4*P4 MAG/P2
01500 | |
01600 ↓ ↓
01700 ***************
01800 It is possible to * * OSCIL
01900 use the output of * * U1 (UNIT GENERATOR ONE)
02000 one instrument to * P5 *
02100 influence other * *
02200 instruments. In * *
02300 the above instrument, *********
02400 'AMPL', the output is | MAG*P3
02500 directed to the RUN- | |
02600 TIME variable PX4. PX4 ↓ ↓
02700 is then used as a ***************
02800 multiplier on the * * OSCIL
02900 amplitude input of the * * U2 (UNIT GENERATOR TWO)
03000 of the envelope of * P6 *
03100 instrument 'INS1'. (The * *
03200 same PX4 could be used * *
03300 in connection with a ********* INSTRUMENT INS1;
03400 group of instruments | OSCIL(PX4*P4,MAG/P2,P5);
03500 similar to 'INS1'.) In ↓ OSCIL(U1,MAG*P3,P6);
03600 this manner an amplitude ***** OUTA←OUTA+U2;
03700 function may be entered * OUT * END;
03800 in P5 of 'AMPL' for the * A * PX4←1;
03900 purpose of controlling *****
04000 amplitude shifts over a
04100 long series of notes. Instrument 'AMPL' would be turned on once
04200 while 'INS1' plays several notes. Each of INS1's notes will have
04300 its own envelope but the amplitude will be constantly scaled by PX4.
04400 If 'AMPL' is not used with 'INS1' then PX4 must be set to 1 so that
04500 the amplitude numbers entered in P4 will function as they have in
04600 the other instruments described. For an example of the use of this
04700 system try the following.
04800
04900 ARRAY F7(512);
05000 SEG(F7); .02,1 1,30 .1,80 .01,100; <OVER-ALL AMPL. SHIFTS
05100 SEG(F1); 0,1 1,8 1,90 0,100; <THE ENVELOPE
05200 SYNTH(F4);1,.5 3,.3 5,.2 7,.1 999; < TIMBRE
05300
05400 PLAY; AMPL 0 8 0 1 F7; <CONTROLS OVER-ALL AMPL.
05500 INS1 0 .2 C 1000 F1 F4; INS1 .2 .2 E; INS1 .4 .2 G ;
05600 INS1 .6 .2 A; INS1 .8 1.6 BF; INS1 2.4 ; < REPEATS THE BF
05700 INS1 4 1.6 B; INS1 5.6 .2 C*2; INS1 5.8 .2 BF;
05800 INS1 6 .2 AF; INS1 6.2 .2 G ; INS1 6.4 1.6 FS; FINISH;
05900
00100 ****** READING IN AND PROCESSING EXTERNAL DIGITAL SOUND FILES *****
00200
00300 A special set of subroutines in the MUS11 program may be called to
00400 read in as many as 4 external sound files simultaneously. The
00500 basic information for initializing this capability is found in the
00600 file 'READ[MUS,LCS]'. This file, which contains four READIN
00700 functions, 'READIN', 'READI2', 'READI3' and 'READI4', is
00800 reproduced in full below.
00900
01000 The first lines are needed to declare the presence of some machine
01100 language routines which read external files from the disk and
01200 unpack the samples in the proper manner. The second set of lines
01300 set up the necessary arrays for temporarily storing the sound
01400 samples. Then a group of variables are declared for transferring
01500 various kinds of information for each 'READIN' function.
01600
01700 SCNT, SCNT2, SCNT3 and SCNT4 are the overall sample counters for
01800 each 'READIN' unit. They must be set to zero each time it is
01900 desired to read from the beginning of a file. After this counter
02000 exceeds the length of the file then zeros will be sent back from
02100 the function.
02200
02300 CNT, CNT2, etc. are sample counters which are used to keep track
02400 of when a new sample buffer must be read in. The other variables
02500 carry the following information:
02600
02700 RD = the value of the current sample.
02800 INCH = NCHNS of the file
02900 INSR = SRATE of the file
03000 INDR = duration of the file in samples
03100 INBT = bits per sample (0 = 12, 1 = 18)
03200 INBUF = 1536 if 12-bit samples, 1024 if 18-bit samples.
03300 INMX = maximum amplitude of file
03400
03500 Note that RD, CNT and SCNT must be 'run-time' variables because
03600 their values must be read for every sample.
03700
03800 ********************************************************************
03900 EXTERNAL FUNCTION GETINF(ARRAY J,INSR,INBT,INCH,INMX,INDR),
04000 RDSMPL(ARRAY N,BITS),GETIN2(ARRAY J,INSR,INBT,INCH,INMX,INDR),
04100 RDSMP2(ARRAY N,BITS),GETIN3(ARRAY J,INSR,INBT,INCH,INMX,INDR),
04200 RDSMP3(ARRAY N,BITS),GETIN4(ARRAY J,INSR,INBT,INCH,INMX,INDR),
04300 RDSMP4(ARRAY N,BITS);
04400
04500 ARRAY INF, IN2, IN3, IN4(1536);
04600 VARIABLE /CNT,/RD,/SCNT,INCH,INSR,INMX,INDR,INBT,INBUF,
04700 /CNT2,/RD2,/SCNT2,INBT2,INBUF2,
04800 /CNT3,/RD3,/SCNT3,INDR3,INBT3,INBUF3,
04900 /CNT4,/RD4,/SCNT4,INDR4,INBT4,INBUF4;
05000
05100 FUNCTION PRNTIT(CNT,INBT,INDR,INBUF);
05200 BEGIN VARIABLE DUR; <***** don't forget to init. SCNT←0; ****
05300 INBUF←1535-512*INBT; DUR←INDR/INSR/INCH;
05400 PRINT "SRATE=",INSR," BITS=",12+INBT*6," NCHNS=",INCH,
05500 " MAXAMP=",INMX," DUR=",DUR;
05600 CNT←2000; < ANY NUMBER > 1536
05700 END;
05800
05900 FUNCTION READIN(RD);
06000 BEGIN <***** DON'T FORGET TO INIT SCNT ← 0;
06100 IF SCNT=0 THEN BEGIN <****** READ HEADER INTO ARRAY INF.
06200 PRINT "****READING ",INFILE,".SND****";
06300 GETINF(INF,INSR,INBT,INCH,INMX,INDR);
06400 PRNTIT(CNT,INBT,INDR,INBUF);
06500 END;
06600 SCNT←SCNT+1; < ***** UPDATE THE COUNTER
06700 IF SCNT > INDR THEN BEGIN <***CHECK IF SMPL CNT IS EXCEEDED
06800 RD←0; RETURN(RD); END;
06900 IF CNT > INBUF THEN BEGIN
07000 RDSMPL(INF,INBT); <**** GET A NEW BUFFER WHEN NECESSARY
07100 CNT←0; END;
07200 RD←INF(CNT); <**** PUT VALUE OF SAMPLE INTO RD
07300 CNT←CNT+1; <**** UPDATE THE COUNTER
07400 RETURN(RD); END; <**** VALUE OF RD IS RETURNED IN READIN(RD)
07500
07600 FUNCTION READI2(RD2); < ***** DUPLICATE OF 'READIN' *****
07700 BEGIN
07800 IF SCNT2=0 THEN BEGIN
07900 PRINT "****READING ",INFIL2,".SND****";
08000 GETIN2(IN2,INSR,INBT2,INCH,INMX,INDR2);
08100 PRNTIT(CNT2,INBT2,INDR2,INBUF2);
08200 END;
08300 SCNT2←SCNT2+1;
08400 IF SCNT2 > INDR2 THEN BEGIN
08500 RD2←0; RETURN(RD2); END;
08600 IF CNT2 > INBUF2 THEN BEGIN
08700 RDSMP2(IN2,INBT2);
08800 CNT2←0; END;
08900 RD2←IN2(CNT2);
09000 CNT2←CNT2+1;
09100 RETURN(RD2); END;
09200
09300 FUNCTION READI3(RD3);
09400 BEGIN
09500 IF SCNT3=0 THEN BEGIN
09600 PRINT "****READING ",INFIL3,".SND****";
09700 GETIN3(IN3,INSR,INBT3,INCH,INMX,INDR3);
09800 PRNTIT(CNT3,INBT3,INDR3,INBUF3);
09900 END;
10000 SCNT3←SCNT3+1;
10100 IF SCNT3 > INDR3 THEN BEGIN
10200 RD3←0; RETURN(RD3); END;
10300 IF CNT3 > INBUF3 THEN BEGIN
10400 RDSMP3(IN3,INBT3);
10500 CNT3←0; END;
10600 RD3←IN3(CNT3);
10700 CNT3←CNT3+1;
10800 RETURN(RD3); END;
10900
11000 FUNCTION READI4(RD4);
11100 BEGIN
11200 IF SCNT4=0 THEN BEGIN
11300 PRINT "****READING ",INFIL4,".SND****";
11400 GETIN4(IN4,INSR,INBT4,INCH,INMX,INDR4);
11500 PRNTIT(CNT4,INBT4,INDR4,INBUF4);
11600 END;
11700 SCNT4←SCNT4+1;
11800 IF SCNT4 > INDR4 THEN BEGIN
11900 RD4←0; RETURN(RD4); END;
12000 IF CNT4 > INBUF4 THEN BEGIN
12100 RDSMP4(IN4,INBT4);
12200 CNT4←0; END;
12300 RD4←IN4(CNT4);
12400 CNT4←CNT4+1;
12500 RETURN(RD4); END;
12600 ***********************************************************
12700
12800 The file 'READ' also contains the following possible READIN
12900 instruments. These instruments simply put some over-all
13000 amplitude envelope on the sound which is read in.
13100 The names of the files to be read in will be in INFILE for
13200 FUNCTION READIN, in INFIL2 for FUNCTION READI2, in INFIL3
13300 for READI3, and in INFIL4 for READI4. !!!!! ONLY 5 LETTERS
13400 MAY BE USED FOR INPUT FILE NAMES AND THE EXTENSION SHOULD
13500 NOT BE USED (.SND IS ASSUMED.)!!! Examples of how to set
13600 the input file names is found in the play list below the
13700 instrument definitions.
13800
13900 ************************************************************
14000
14100 SEG(F6);0 0 .7 20 .5 50 1 80 0 100; <ENVELOPE ON INPUT SOUND.
14200 INSTRUMENT READA; <**** A POSSIBLE READIN INSTRUMENT.
14300 OSCIL(P4,MAG/P2,F6);
14400 OUTA←OUTA+U1*READIN(RD);
14500 END;
14600 INSTRUMENT READB;
14700 OSCIL(P4,MAG/P2,F6);
14800 OUTA←OUTA+U1*READI2(RD2);
14900 END;
15000 INSTRUMENT READC;
15100 OSCIL(P4,MAG/P2,F6);
15200 OUTA←OUTA+U1*READI3(RD3);
15300 END;
15400 INSTRUMENT READD;
15500 OSCIL(P4,MAG/P2,F6);
15600 OUTA←OUTA+U1*READI4(RD4);
15700 END;
15800
15900 OUTFILE←"RD.SND"; <**** the extension must appear here.
16000 PLAY;
16100 READA 0 .37 0 2; <*** amplitude will be doubled
16200 INFILE←"U"; <FILE NAME TO BE READ IN FOR NOTE ABOVE THIS LINE!!!
16300 SCNT←0; <initialize counter file above.
16400 READB .3 .37 0 1; <**** amplitude will be unchanged
16500 INFIL2←"A"; <FILE NAME TO BE READ IN. (.SND extension assumed.)
16600 SCNT2←0; < intitialize the counter
16700 READC .8 .37 0 .7; <**** note the amplitude
16800 INFIL3←"I"; <FILE NAME TO BE READ IN.
16900 SCNT3←0;
17000 READA 1.3 .37 0 .8; SCNT←0; <*** use READA again
17100 INFILE←"U"; <FILE NAME TO BE READ IN FOR NOTE ABOVE THIS LINE!!!
17200 FINI;
17300
17400 ********************************************************************
17500
17600 Just before the above play list the output file name has been set
17700 'RD.SND'. (When the output file name is changed the extension
17800 must!! be given.) Within the play list the mention of each READIN
17900 instrument is immediately followed!! by the input file name and
18000 the initialization of the main sample counter for that READIN
18100 function.
18200
18300 The names of the input files must have the extension '.SND' but
18400 the extensions should not be typed here. Parameter 2 tells how
18500 long the READIN instrument is to be turned on. Normally P2 would
18600 be set to at least the duration of the file being read in. In
18700 these instruments P4 can be used to scale the original amplitudes.
18800
18900 Many different sorts of instruments may be designed to make use of
19000 the READIN functions. For example mono input samples may be
19100 processed into stereo output, the samples may be reverberated or
19200 the samples may be amplitude-modulated in many ways.
19300
19400
19500 ******** VARIABLE INCREMENT RATES IN READA **********************
19600
19700 The following variant of the READIN function allows you to alter
19800 the increment, or reading rate, of the input file. This has the
19900 effect of dynamically altering the sample rate of the input sound.
20000 To avoid rough edges, an interpolation section has been added to
20100 the READIN function.
20200
20300 ******************************************************************
20400
20500 EXTERNAL FUNCTION GETINF(ARRAY J,INSR,INBT,INCH,INMX,INDR),
20600 RDSMPL(ARRAY N,BITS);
20700
20800 ARRAY INF(1536);
20900 VARIABLE /CNT,/RD,/SCNT,INCH,INSR,INMX,INDR,INBT,INBUF,
21000 IX,/INC,RX,JZ,IZ;
21100
21200 FUNCTION PRNTIT(CNT,INBT,INDR,INBUF);
21300 BEGIN
21400 INBUF←1535-512*INBT ;
21500 PRINT "SRATE=",INSR," BITS=",12+INBT*6," NCHNS=",INCH,
21600 " MAXAMP=",INMX," DUR=",INDR/INSR/INCH;
21700 INDR←INDR-2;
21800 END;
21900
22000 FUNCTION READIN(RD);
22100 BEGIN <DON'T FORGET TO INIT AND SCNT ← 0;
22200 IF SCNT=0 THEN BEGIN
22300 GETINF(INF,INSR,INBT,INCH,INMX,INDR); <HEADER IS READ INTO ARRAY INF.
22400 PRNTIT(CNT,INBT,INDR,INBUF);
22500 RDSMPL(INF,INBT);
22600 CNT←0; JZ←0; RX←INF(0);
22700 END;
22800 SCNT←SCNT+INC;
22900 IF SCNT > P6 THEN INC←INC+P5;<******SPECIAL FEATURE***************
23000
23100 IF SCNT > INDR THEN BEGIN <CHECK TO SEE IF SMPL CNT IS EXCEEDED
23200 RD←0; RETURN(RD); END;
23300 IX ← INF(JZ);
23400 IZ←1-INT(JZ)+CNT;
23500 RD←RX+(IX-RX)*IZ; < INTERPOLATION
23600 CNT←CNT+INC; <UPDATE THE COUNTER
23700
23800 IF CNT < INBUF THEN RX←INF(CNT);
23900 JZ←CNT+1;
24000
24100 IF JZ ≥ INBUF THEN BEGIN
24200 RDSMPL(INF,INBT);
24300 JZ←JZ-INBUF;
24400 CNT←JZ-1;
24500 IF CNT ≥ 0 THEN RX←INF(CNT);
24600 END;
24700 RETURN(RD);
24800 END;
24900
25000 ************************************************************
25100
25200 INSTRUMENT READA;
25300 OUTA←OUTA+P4*READIN(RD);
25400 END;
25500
25600 INC←1; < MUST BE INITIALIZED.
25700 PLAY;
25800 READA 0 .37 0 1.3 .00025 1920;
25900 SCNT←0; INFILE←"U";
26000 FINISH;
26100
26200 ***************************************************************
26300
26400 In the above example P5 is used to cause a slight change in the
26500 increment rate. P6 is used (in the function) to tell when the
26600 increment rate will begin to change. In the above case a vowel,
26700 "ou" (human voice), is processed to have an upward inflection at
26800 the end. The change in the increment may seem to be very small
26900 but after 12800 samples (or 1 second) the increment will be up to
27000 2.5.
00100 ********* PRELIMINARY INFORMATION REGARDING REVERBERATION *********
00200
00300 ARRAY D1(801),D2(901),D3(1011),D4(1123),D5(123),D6(43),D7(13);
00400 VARIABLE /R;
00500 REVINIT←1;R←0;
00600
00700 INSTRUMENT REV;
00800 REV1(R,801,.827,D1);
00900 REV1(R,901,.805,D2);
01000 REV1(R,1011,.783,D3);
01100 REV1(R,1123,.764,D4);
01200 REV2(U1+U2+U3+U4,123,.7,D5);
01300 REV2(U5,43,.7,D6);
01400 REV2(U6,13,.7,D7);
01500 R←0;OUTA←OUTA+U7;
01600 END;
01700
01800 IN THE EXAMPLE ABOVE THE TOP LINE DECLARES THE ARRAYS TO BE USED.
01900 THE RUN-TIME VARIABLE, R, PICKS UP DATA FROM THE REGULAR
02000 INSTRUMENTS TO PASS ON TO THE REV INSTRUMENT. When a variable is
02100 declared with a preceding slash ( /R ) it is known as a "run-time"
02200 variable. This means that, unlike ordinary parameters which are
02300 read by an instrument only at the beginning of a note (at input
02400 time, or "I-time"), a "run-time" variable is read or changed every
02500 time a sample is computed. ORDINARY VARIABLES [NO SLASH WHEN THEY
02600 ARE FIRST DECLARED] ARE FIXED EACH TIME THE PARAMETERS FOR AN
02700 INSTRUMENT ARE READ IN.
02800
02900 EVERY TIME INSTRUMENT REV COMPUTES A SAMPLE, R IS SET BACK TO 0
03000 (LINE JUST ABOVE 'END') SO THAT DATA FROM ONE SAMPLE WILL NOT MIX
03100 WITH THAT FROM THE NEXT. THE REV1 AND REV2 UNIT GENERATORS ARE
03200 ESSENTIALLY FEEDBACK LOOPS WITH DELAY TIMES (IN SAMPLES) EQUAL TO
03300 THE FIRST NUMBER APPEARING IN THE PARENTHESES, WITH THE SECOND
03400 NUMBER (LESS THAN 1) BEING THE MULTIPLIER (OR GAIN) USED EACH TIME
03500 A SAMPLE MAKES THE LOOP.
03600
03700 THE USUAL WAY TO USE REVERBERATION IS TO TAP THE OUTPUT OF EACH
03800 INSTRUMENT, PUTTING A PERCENTAGE OF THE SIGNAL INTO R (USUALLY 10
03900 TO 20%). THE RELATIONSHIP BETWEEN THE PERCENTAGE OF DIRECT SIGNAL
04000 TO THE PERCENTAGE OF REVERBERATED SIGNAL SEEMS TO BE THE THE MOST
04100 IMPORTANT ELEMENT IN GIVING THE ILLUSION OF VARYING DISTANCES.
04200
04300 IN THE FOLLOWING EXAMPLE IT WILL BE ASSUMED THAT 5 UNIT GENERATORS
04400 INVOLVING 8 PARAMETERS ARE USED IN THE INSTRUMENT PROPER. THEN
04500 THE LAST LINES WOULD BE:
04600
04700 R←R+U5*P8;
04800 OUTA←OUTA+U5*P9;
04900 END;
05000
05100 THUS P8 WILL HAVE THE PERCENTAGE OF THE SIGNAL TO BE REVERBERATED.
05200 THE PERCENTAGE OF THE SOUND CONSIDERED TO BE THE DIRECT SIGNAL IS
05300 DETERMINED BY P9. THE SUM OF P8 AND P9 CAN BE GREATER THAN 1, BUT
05400 REMEMBER THAT REVERBERATION CAUSES INCREASES IN THE TOTAL
05500 AMPLITUDE WHICH ARE DIFFICULT TO REPEAT.
05600
05700 IN GENERAL THE REV INSTRUMENT SHOULD BE TURNED ON ONLY ONCE,
05800 "PLAYING" ONE LONG "NOTE" FOR THE DURATION OF A PIECE. IN THE
05900 FOLLOWING EXAMPLE THE ASSUMPTION IS THAT THE TOTAL DURATION OF THE
06000 REGULAR NOTES IS 42". REV PLAYS 2" LONGER TO ALLOW THE
06100 REVERBERATION TO DIE AWAY.
06200
06300 REVINIT←1;R←0;
06400 PLAY;REV 0 42;
06500 --- [ALL THE NOTES FOLLOW] --
06600 FINISH;
06700
06800 IF A LONGER WORK (SAY 2 1/2') IS TO BE DONE IN SECTIONS -- FOR
06900 EVENTUALLY EITHER ONE LONG PLAY FROM THE COMPUTER OR FOR TAPE
07000 SPLICING OF THE SEPARATE SECTIONS -- DO AS FOLLOWS:
07100
07200 REVINIT←1;R←0;
07300 PLAY;REV 0 37.3;REVINIT←0;
07400 --- [THE NOTES FOR EXACTLY 37.3" FOLLOW] --
07500 FINISH;
07600
07700 -- THEN, USING THE SAME CORE IMAGE (SO THE LAST STATE OF THE
07800 REVERBERATOR WILL BE PRESERVED):
07900
08000 PLAY;REV 0 78;
08100 --- [NOTES FOR EXACTLY 78"] --
08200 FINISH;
08300
08400 -- THEN THE FINAL SECTION*
08500
08600 PLAY;REV 0 37;
08700 --- [NOTES FOR THE LAST 34.7"] --
08800 FINISH;
08900
09000 WHEN THESE THREE PARTS ARE PIECED TOGETHER THERE WILL BE NO GAPS
09100 IN THE REVERBERATION, WHICH WILL EXTEND 2.3" BEYOND THE FINAL
09200 NOTE.
09300
09400 I AM NOT TOO SURE ABOUT THE FUNCTION OF REVINIT. I BELIEVE IT
09500 MUST BE SET BACK TO ZERO AFTER! THE FIRST PLAYING OF REV IF YOU
09600 WISH TO HAVE THE REVERBERATION CARRY OVER FROM ONE PLAY;...FINISH;
09700 INTO THE NEXT.
09800
09900
10000
10100
00100 ********** APPENDIX XXX NOT COMPLETE!!!XXX ************
00200
00300 This main program for sound generation is currently found in
00400 MUS11A.FAI and MUS11B.FAI.
00500 It should be found on the area [MUS,LCS].
00600
00700 The main program must be loaded by means of the following command
00800 file: MUS11.CMD Type: LOAD @MUS11
00900
01000 When 'INPUT?' appears then type: INIT.MUS[MUS,LCS]
01100 This reads in all necessary initialization.
01200 At this point the core image should be saved
01300 under some appropriate name.
01400
01500 Reading in INIT.MUS causes 5 instruments and 6 functions to be
01600 predefined in MUS11. This instrument names are SIMP, TOOT, CLAR,
01700 BRIT and BUZZ. Instrument SIMP is of the type described in the first
01800 section of this document. It has no envelope. The parameter
01900 structure is as follows.
02000
02100 P1 = begin time of note (in seconds)
02200 P2 = duration of note " "
02300 P3 = pitch
02400 P4 = amplitude
02500 P5 = wave form (or timbre)
02600
02700 The other 4 instruments are all of the same type (see section 3)
02800 however the tone-color parameter for each instrument is different.
02900
03000 P1 = begin time of note (in seconds)
03100 P2 = duration of note " "
03200 P3 = pitch
03300 P4 = amplitude
03400 P5 = envelope (F2)
03500 P6 = wave form (or timbre) for instrument TOOT (F1)
03600 P7 = wave form for instrument CLAR (F4)
03700 P8 = wave form for instrument BRIT (F5)
03800 P9 = wave form for instrument BUZZ (F6)
03900
04000 The names of the functions present are F1, F2, F3, F4, F5 and F6.
04100 F2 is a mezzo-legato envelope; F3 is a semi-staccato envelope; F1
04200 is a simple sine wave; F4 is a wave using only the 1st, 3rd, 5th
04300 and 7th harmonics; F5 has an assortment of harmonics up to the
04400 11th and F6 is a triangular pulse. The details of these waves may
04500 be seen in the file INIT.MUS.
04600
04700 There are many more unit generators available than have been
04800 discussed in this document. See MUS11.LCS[UP,DOC] for a detailed
04900 description of the MUS11 program.
05000
05100 All the unit generators discussed have been non-interpolating.
05200 Interpolating forms of most unit generators are available by
05300 adding a first letter 'Z'. (ZOSCIL, ZCOSCIL, ZNOSCIL, ZINTRP)
05400 These unit generators give smoother sound (especially for long,
05500 slow glissandos) but they are a luxury in that they involve
05600 considerably more computation time.
05700
05800
05900 'MUS11' computes sound in 12-bit samples, at 12800 samples per
06000 second, unless told otherwise. The other sample size available
06100 is 18. (Really 16.)
06200 To change from the default size, type: BITS←18;
06300
06400 The 'MUS11' program always writes a record of information (HEADER)
06500 at the beginning of each sound file. This record contains
06600 information about the sampling rate, number of channels, bits per
06700 sample, amplitude, etc. Thus the playback programs may adjust
06800 automatically to each set of conditions.
06900
07000 The default name for sound files is 'TEST.SND'. The name may be
07100 changed in the following manner.
07200
07300 OUTFILE←"NAME.SND"; <NAME may be any desired name.
07400
07500 However when it comes time to play the sound this new NAME must be
07600 typed. If the extension '.SND' has been used it need not be typed
07700 for playing.
07800
07900
08000 ***** PUTTING SOUND ON A UDP *****
08100
08200 When using a UDP (User Disk Pack) several steps must be followed.
08300
08400 1. Be sure the proper disk pack is mounted. For instructions on
08500 this ask someone who is already familiar with the process.
08600 DON'T TRY TO DO THIS WITHOUT INSTRUCTION!
08700
08800 2. Assign the UDP to be used. Create a directory area.
08900 Again, ask someone who knows how this is done.
09000
09100 3. Now the device name must appear in your OUTFILE specification.
09200 Example: OUTFILE←"UDP2:NAME.SND";
09300
09400 From this point on all should proceed in a normal fashion.
09500
09600
09700 ***** PUTTING SOUND ON MAGTAPE ***(NOT GENERALLY USEFUL)****
09800
09900 1. Assign the tape drive. (Only MTA0 or MTA1 are available.)
10000 2. Mount the tape and be sure it is at the "load point".
10100
10200 3. The device name must appear in your OUTFILE specification.
10300 Example: OUTFILE←"MTA0:X.X";
10400 In this case the file name, X.X, is a dummy.
10500 When using tape, this program does not rewrite the header
10600 when the computation is done. Hence things like the maximum
10700 amplitude and the total duration will not be found in the
10800 header. To cause the duration to appear in the header the
10900 variable MTADUR may be used. Example: MTADUR←54.03; will
11000 put that duration into the header on a tape.
11100
11200 4. To play the sound which has been computed onto tape, the tape
11300 must be rewound and then copied to the DSK after which it can
11400 be heard by using the PLAY program.
11500
11600
11700 ***** SAVE FEATURE ***( SAVCNT )*****
11800
11900 When doing long computations (more than c.30" of sound) it is
12000 generally advisable to use the SAVE feature. This feature is
12100 activated through the variable SAVCNT. A number put into SAVCNT
12200 tells how many "records" are to be written between each SAVE of
12300 the program. Normally 100 will be a good number. (SAVCNT←100;)
12400 With this feature the program may be stopped and then restarted
12500 at a later time. Each time the program is saved a file called
12600 NAME.SAV is written, where NAME is the name of the input notelist
12700 being used. In this case the program may be restarted by typing
12800 RUN NAME.SAV. When the computation is finished the .SAV file
12900 should be deleted.
00100 ****** Information re. FUNC. To run type R FUNC ********************
00200
00300 This program is largely self-instructional. Practice a bit with it
00400 before attempting to do serious work. The output of the FUNC program
00500 will always be a file with the extension '.FUN'. File names can have
00600 no more than 5 letters and function names can have no more than 3
00700 letters. Up to 10 functions may be stored in each .FUN file. (These
00800 files are designed to be edited only!!! by the FUNC program itself.
00900 Use of the 'ET' editor with .FUN files usually destroys their
01000 format.)
01100
01200 CRUNCH: Any two functions already in a single .FUN file may be
01300 "crunched" together. Also, a function may be created by either the
01400 SEG or SYNTH routines and then if instead of typing "F" for FINISH
01500 the letter "C" is typed the program will jump immediately to "crunch"
01600 mode. At this point the new function may be combined with any
01700 function found in the file presently in core. Note however that once
01800 this new function is processed by any of "crunch" options its
01900 original form cannot be regained without going back to ordinary SEG
02000 or SYNTH mode.
02100
02200 PLOTTING: If "SP" (=see on the plotter) is typed single functions
02300 can be drawn on the Calcomp plotter. The size asked for is in
02400 inches. "SA" (=see all on plotter) will plot all the functions found
02500 in a single file.
02600 "SX" (=see all on the XGP) will draw all functions from a single
02700 file in the proper size for printing by the XGP. In order to use
02800 "SX" you must!!! follow the next steps exactly!!!
02900
03000 Before running FUNC type: A DSK PLT <CR>. This will cause the
03100 instructions FUNC sends to the plotter to be written in a
03200 file on the disk.
03300
03400 When the FUNC program finishes then type R X <CR>.
03500 This runs a program called X which converts plotter
03600 information to XGP commands.
03700
03800 X will ask you 5 questions. You should answer as follows:
03900
04000 PLOT.BIN <CR> (the file name)
04100 <CR> (plot slice?)
04200 5 <CR> (shift 5 inches)
04300 <CR> (use default value of 11".)
04400 1 <CR> (1 inch from the left)
04500 Y (yes, delete the plot file)
04600
04700
04800
04900 ********* Information re. WAVES. To run it type R WAVES **********
05000
05100 This will allow you to display the actual wave shapes of sound
05200 computed by MUS11. The TEST.SND file thus produced is read by WAVES.
05300
05400 (When WAVES asks "TYPE FILE NAME", a simple <CR> will be the
05500 equivalent of typing TEST.SND <CR> .)
05600
05700
05800 ********* Information re. MIXER. To run type R MIXER *************
05900
06000 This program allows you to mix or splice 2 sound files together.
06100 There are a few restrictions in the use of this program. Both files
06200 must use the same sampling rate, the same number of channels and the
06300 the same bit size. The amplitudes of each file may be scaled as you
06400 wish. After mixing 2 files, the result may be in turn mixed with a
06500 third file, etc.
06600